<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>预览失败</title>
    <style>
        :root {
            --color-primary: #165dff;
            --color-text-1: #ffffff;
            --color-text-2: rgba(255, 255, 255, 0.7);
            --color-text-3: rgba(255, 255, 255, 0.5);
            --color-bg-1: #1a1a1a;
            --color-bg-2: #000000;
            --color-border: rgba(255, 255, 255, 0.1);
            --color-fill-2: rgba(255, 255, 255, 0.1);
            --color-danger: #f53f3f;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "noto sans", "Microsoft YaHei", "SimSun", sans-serif;
            background: var(--color-bg-2);
            height: 100vh;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            user-select: none;
        }

        .header {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 20px;
            background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
            z-index: 10;
            color: var(--color-text-1);
            pointer-events: none;
        }

        .header > * {
            pointer-events: auto;
        }

        .file-name {
            font-size: 14px;
            opacity: 0.9;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
        }

        .close-btn {
            cursor: pointer;
            padding: 8px;
            border-radius: 4px;
            transition: background 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .close-btn:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        .error-container {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 40px;
        }

        .error-content {
            text-align: center;
            max-width: 500px;
        }

        .error-title {
            font-size: 20px;
            font-weight: 500;
            color: var(--color-text-1);
            margin-bottom: 12px;
        }

        .error-message {
            font-size: 14px;
            color: var(--color-text-2);
            margin-bottom: 20px;
            line-height: 1.6;
        }

        .error-detail {
            font-size: 13px;
            color: var(--color-text-3);
            padding: 12px;
            background: var(--color-fill-2);
            border-radius: 4px;
            margin-bottom: 20px;
            word-break: break-word;
        }
    </style>
</head>
<body>
<div class="header">
    <span class="file-name">预览失败</span>
    <div class="close-btn" onclick="window.close()" title="关闭">
        <svg width="24" height="24" viewBox="0 0 48 48" fill="none">
            <path d="M14 14L34 34" stroke="white" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
            <path d="M14 34L34 14" stroke="white" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
        </svg>
    </div>
</div>

<div class="error-container">
    <div class="error-content">
        <div class="error-title" th:text="${errorMessage != null ? errorMessage : '无法加载文件预览'}">
            无法加载文件预览
        </div>
        <div class="error-detail" th:if="${errorDetail != null}" th:text="${errorDetail}">
            文件不存在或已被删除
        </div>
    </div>
</div>

<script>
    // Disable context menu
    document.addEventListener('contextmenu', (e) => {
        e.preventDefault();
    });
</script>
</body>
</html>